gtkmenu: ignore left/right scroll events
authorOlivier Fourdan <ofourdan@redhat.com>
Mon, 9 May 2016 06:56:56 +0000 (08:56 +0200)
committerOlivier Fourdan <ofourdan@redhat.com>
Tue, 10 May 2016 13:58:02 +0000 (15:58 +0200)
Menus are placed vertically by definition, it does not make much sense
to support horizontal axis for scrolling.

Use GDK_EVENT_STOP/GDK_EVENT_PROPAGATE instead of TRUE/FALSE and add a
default case to return GDK_EVENT_PROPAGATE for unhandled events.

https://bugzilla.gnome.org/show_bug.cgi?id=765939

gtk/gtkmenu.c

index ee24b724cc3e87f35aa31c9ec1cffdf166e3194a..78275d291bbe084d85fa2244a901625eeb383d10 100644 (file)
@@ -3557,24 +3557,25 @@ gtk_menu_scroll (GtkWidget      *widget,
   GtkMenu *menu = GTK_MENU (widget);
 
   if (_gdk_event_get_pointer_emulated ((GdkEvent *) event))
-    return FALSE;
+    return GDK_EVENT_PROPAGATE;
 
   switch (event->direction)
     {
-    case GDK_SCROLL_RIGHT:
     case GDK_SCROLL_DOWN:
       gtk_menu_scroll_by (menu, MENU_SCROLL_STEP2);
       break;
-    case GDK_SCROLL_LEFT:
     case GDK_SCROLL_UP:
       gtk_menu_scroll_by (menu, - MENU_SCROLL_STEP2);
       break;
     case GDK_SCROLL_SMOOTH:
       gtk_menu_scroll_by (menu, event->delta_y * MENU_SCROLL_STEP2);
       break;
+    default:
+      return GDK_EVENT_PROPAGATE;
+      break;
     }
 
-  return TRUE;
+  return GDK_EVENT_STOP;
 }
 
 static void